package 剑指offer;

public class _46把数字翻译成字符串 {
    public int translateNum(int num) {
        String s = String.valueOf(num);
        int p = 1, q = 1, res = 1;
        for(int i = 1; i < s.length(); i++){
            String sub = s.substring(i - 1,i + 1);
            if(sub.compareTo("25") <= 0 && sub.compareTo("10") >= 0 ){
                res = p + q;
                p = q;
                q = res;
            }else{
                res = q;
                p = q;
            }
        }
        return res;
    }
}
